home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / glibc-1.09 / glibc-1 / glibc-1.09.1 / Makerules < prev    next >
Encoding:
Text File  |  1994-11-03  |  18.3 KB  |  541 lines

  1. # Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
  2. # This file is part of the GNU C Library.
  3.  
  4. # The GNU C Library is free software; you can redistribute it and/or
  5. # modify it under the terms of the GNU Library General Public License as
  6. # published by the Free Software Foundation; either version 2 of the
  7. # License, or (at your option) any later version.
  8.  
  9. # The GNU C Library is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. # Library General Public License for more details.
  13.  
  14. # You should have received a copy of the GNU Library General Public
  15. # License along with the GNU C Library; see the file COPYING.LIB.  If
  16. # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  17. # Cambridge, MA 02139, USA.
  18.  
  19. #
  20. #    Common rules for making the GNU C library.  This file is included
  21. #    by the top-level Makefile and by all subdirectory makefiles
  22. #    (through Rules).
  23. #
  24. ifneq (,)
  25. This makefile requires GNU Make.
  26. endif
  27.  
  28.  
  29. ifdef    subdir
  30. ..    := ../
  31. endif    # subdir
  32.  
  33. # If `sources' was defined by the parent makefile, undefine it so
  34. # we will later get it from wildcard search in this directory.
  35. ifneq    "$(findstring env,$(origin sources))" ""
  36. sources :=
  37. endif
  38.  
  39. headers := $(headers) $(sysdep_headers)
  40.  
  41. oPATH := $(PATH)
  42. PATH := this definition should take precedence over $(oPATH)
  43. ifeq ($(PATH),$(oPATH))
  44. You must not use the -e flag when building the GNU C library.
  45. else
  46. PATH := $(oPATH)
  47. endif
  48.  
  49. ifndef +included-Makeconfig
  50. include $(..)Makeconfig
  51. endif
  52.  
  53. # `configure' writes a definition of `config-sysdirs' in `config.make'.
  54. sysdirs = $(config-sysdirs)
  55.  
  56. +sysdir_pfx = $(common-objpfx)
  57.  
  58. export sysdirs := $(sysdirs)
  59.  
  60. +sysdep_dirs := $(addprefix $(sysdep_dir)/,$(sysdirs))
  61. ifdef objdir
  62. +sysdep_dirs := $(objdir) $(+sysdep_dirs)
  63. endif
  64.  
  65. # Add -I switches to get the right sysdep directories.
  66. # `+includes' in Makeconfig references $(+sysdep-includes).
  67. +sysdep-includes := $(addprefix -I,$(+sysdep_dirs))
  68.  
  69. # Include any system-specific makefiles.
  70.  
  71. # This is here so things in sysdep Makefiles can easily depend on foo.h as
  72. # appropriate and not worry about where foo.h comes from, which may be
  73. # system dependent and not known by that Makefile.
  74. vpath %.h $(subst $(empty) ,:,$(strip $(common-objpfx) \
  75.                       $(addprefix $(sysdep_dir)/,$(sysdirs)) \
  76.                       $(..)))
  77.  
  78. ifeq ($(wildcard $(+sysdir_pfx)sysd-Makefile),)
  79. # Don't do deps until this exists, because it might change the sources list.
  80. no_deps=t
  81. endif
  82.  
  83. # Some sysdep makefiles use this to distinguish being included here from
  84. # being included individually by a subdir makefile (hurd/Makefile needs this).
  85. in-Makerules := yes
  86.  
  87. include $(+sysdir_pfx)sysd-Makefile
  88. $(+sysdir_pfx)sysd-Makefile: $(+sysdir_pfx)config.make $(..)Makerules
  89.     -@rm -f $@T
  90.     (for dir in $(sysdirs); do                             \
  91.        file=sysdeps/$$dir/Makefile;                          \
  92.        if [ -f $(..)$$file ]; then                          \
  93.          echo include "\$$(..)$$file";                      \
  94.        else true; fi;                              \
  95.      done; \
  96.      echo 'sysd-Makefile-done=t') > $@T
  97.     mv -f $@T $@
  98.  
  99.  
  100. # Reorder before-compile so that mach things come first, and hurd things
  101. # second, before all else.  The mach and hurd subdirectories have many
  102. # generated header files which the much of rest of the library depends on,
  103. # so it is best to build them first (and mach before hurd, at that).
  104. before-compile := $(filter $(common-objpfx)mach% $(common-objpfx)hurd%,\
  105.                $(before-compile)) \
  106.           $(filter-out $(common-objpfx)mach% $(common-objpfx)hurd%,\
  107.                    $(before-compile))
  108.  
  109. # Remove existing files from `before-compile'.  Things are added there when
  110. # they must exist for dependency generation to work right, but once they
  111. # exist there is no further need for every single file to depend on them,
  112. # and those gratuitous dependencies result in many gratuitous
  113. # recompilations.
  114. before-compile := $(filter-out $(wildcard $(before-compile)),$(before-compile))
  115.  
  116. # Don't let any before-compile file be an intermediate and get removed.
  117. ifdef before-compile
  118. $(before-compile):
  119. endif
  120.  
  121. # Generate an ordered list of implicit rules which find the source files in
  122. # each sysdep directory.  The old method was to use vpath to search all the
  123. # sysdep directories.  However, that had the problem that a .S file in a
  124. # later directory would be chosen over a .c file in an earlier directory,
  125. # which does not preserve the desired sysdeps ordering behavior.
  126.  
  127. # When making the list of .d files to include, we can't know which ones
  128. # have source in .s files, and thus do not in fact need a .d file.
  129. # So we must define rules to make .d files for .s files.
  130. define make-dummy-dep
  131. $(addprefix ln $(objpfx)dummy.d ,$(filter-out $(wildcard $@),$@))
  132. endef
  133. $(objpfx)dummy.d:
  134.     echo '# .s files cannot contain includes, so they need no deps.' > $@
  135.  
  136. # It matters that this set of rules, for compiling from sources in
  137. # the current directory (the $srcdir/$subdir) come before the
  138. # generated sysdep rules in included from sysd-rules below.  When
  139. # compiling in the source tree, generated sources go into the current
  140. # directory, and those should be chosen before any sources in sysdeps.
  141. $(objpfx)%.o: %.S $(before-compile); $(compile-command.S)
  142. $(objpfx)%.d: %.S $(before-compile); $(+make-deps)
  143. $(objpfx)%.o: %.s $(before-compile); $(compile-command.s)
  144. $(objpfx)%.d: %.s $(objpfx)dummy.d; $(make-dummy-dep)
  145. $(objpfx)%.o: %.c $(before-compile); $(compile-command.c)
  146. $(objpfx)%.d: %.c $(before-compile); $(+make-deps)
  147.  
  148. # Omit the objpfx rules when building in the source tree, because
  149. # objpfx is empty and so these rules just override the ones above.
  150. ifdef objpfx
  151. # Define first rules to find the source files in $(objpfx).
  152. # Generated source files will end up there.
  153. $(objpfx)%.o: $(objpfx)%.S $(before-compile); $(compile-command.S)
  154. $(objpfx)%.d: $(objpfx)%.S $(before-compile); $(+make-deps)
  155. $(objpfx)%.o: $(objpfx)%.s $(before-compile); $(compile-command.s)
  156. $(objpfx)%.d: $(objpfx)%.s $(objpfx)dummy.d; $(make-dummy-dep)
  157. $(objpfx)%.o: $(objpfx)%.c $(before-compile); $(compile-command.c)
  158. $(objpfx)%.d: $(objpfx)%.c $(before-compile); $(+make-deps)
  159. endif
  160.  
  161. # System-dependent makefiles can put in `inhibit-sysdep-asm' wildcard
  162. # patterns matching sysdep directories whose assembly source files should
  163. # be suppressed.
  164. ifdef inhibit-sysdep-asm
  165. define open-check-inhibit-asm
  166. case $$sysdir in $(subst $(empty) ,|,$(inhibit-sysdep-asm))) : ;; *)
  167. endef
  168. close-check-inhibit-asm = ;; esac
  169. endif
  170.  
  171. # Don't include sysd-rules until sysd-Makefile is already there and has been
  172. # included.  It might define inhibit-sysdep-asm, which would affect the
  173. # contents of sysd-rules.
  174. ifdef sysd-Makefile-done
  175. include $(+sysdir_pfx)sysd-rules
  176. endif
  177. $(+sysdir_pfx)sysd-rules: $(+sysdir_pfx)config.make $(..)Makerules \
  178.               $(wildcard $(foreach dir,$(sysdirs),\
  179.                            $(sysdep_dir)/$(dir)/Makefile))
  180.     -@rm -f $@T
  181.     (for sysdir in $(sysdirs); do                             \
  182.        dir="\$$(sysdep_dir)/$$sysdir";                      \
  183.        $(open-check-inhibit-asm) \
  184.        echo "\$$(objpfx)%.o: $$dir/%.S \$$(before-compile); \
  185.         \$$(compile-command.S)";                      \
  186.        echo "\$$(objpfx)%.d: $$dir/%.S \$$(before-compile); \
  187.         \$$(+make-deps)";                          \
  188.        echo "\$$(objpfx)%.o: $$dir/%.s \$$(before-compile); \
  189.         \$$(compile-command.s)";                      \
  190.        echo "\$$(objpfx)%.d: $$dir/%.s \$$(objpfx)dummy.d; \
  191.         \$$(make-dummy-dep)" $(close-check-inhibit-asm);    \
  192.        echo "\$$(objpfx)%.o: $$dir/%.c \$$(before-compile); \
  193.         \$$(compile-command.c)";                      \
  194.        echo "\$$(objpfx)%.d: $$dir/%.c \$$(before-compile); \
  195.         \$$(+make-deps)";                          \
  196.      done) > $@T
  197.     mv -f $@T $@
  198.  
  199. ifndef compile-command.S
  200. compile-command.S = $(compile.S) $(OUTPUT_OPTION)
  201. endif
  202. ifndef compile-command.s
  203. compile-command.s = $(COMPILE.s) $< $(OUTPUT_OPTION)
  204. endif
  205. ifndef compile-command.c
  206. compile-command.c = $(compile.c) $(OUTPUT_OPTION)
  207. endif
  208.  
  209. ifeq ($(notdir $(firstword $(CC))),gcc)
  210. # GCC can grok options after the file name, and it looks nicer that way.
  211. compile.S = $(CC) $< -c $(CPPFLAGS) -DASSEMBLER $(asm-CPPFLAGS)
  212. compile.c = $(CC) $< -c $(CFLAGS) $(CPPFLAGS)
  213. else
  214. compile.S = $(COMPILE.S) -DASSEMBLER $(asm-CPPFLAGS) $<
  215. compile.c = $(COMPILE.c) $<
  216. endif
  217.  
  218. ifndef OUTPUT_OPTION
  219. ifdef objpfx
  220. # We need this for the output to go in the right place.  It will default to
  221. # empty if make was configured to work with a cc that can't grok -c and -o
  222. # together.  You can't compile the C library with such a compiler.
  223. OUTPUT_OPTION = -o $@
  224. endif
  225. endif
  226.  
  227. S-CPPFLAGS = $(asm-CPPFLAGS)
  228. define +make-deps
  229. -@rm -f $@
  230. $(+mkdep) $< $(CPPFLAGS) $($(<:$*.%=%)-CPPFLAGS) | \
  231. sed -e 's,$*\.o,$(@:.d=.o) $@,' $(sed-remove-objpfx) > $(@:.d=.T)
  232. mv -f $(@:.d=.T) $@
  233. endef
  234. ifneq (,$(objpfx))
  235. sed-remove-objpfx = -e 's@ $(subst @,\@,$(objpfx))@ $$(objpfx)@g' \
  236.             -e 's@^$(subst @,\@,$(objpfx))@$$(objpfx)@g'
  237. endif
  238.  
  239. # Figure out the source filenames in this directory.
  240.  
  241. override sources    := $(addsuffix .c,$(filter-out $(elided-routines),\
  242.                                $(routines) $(aux) \
  243.                                $(sysdep_routines)))
  244. sysdep_routines := $(sysdep_routines)
  245.  
  246. # This is the list of all object files, gotten by
  247. # replacing every ".c" in `sources' with a ".o".
  248. override objects    := $(addprefix $(objpfx),$(sources:.c=.o))
  249.  
  250. +depfiles := $(strip $(sources:.c=.d) \
  251.              $(patsubst %.o,%.d,$(filter %.o,$(extra-objs))) \
  252.              $(addsuffix .d,$(others) $(tests)))
  253. +depfiles := $(addprefix $(objpfx),\
  254.              $(filter-out $(addsuffix .d,$(omit-deps)),\
  255.                       $(+depfiles)))
  256.  
  257. $(objpfx)depend-$(subdir): Makefile
  258. ifdef +depfiles
  259.     for file in $(+depfiles:$(objpfx)%=%); do \
  260.       echo "include \$$(objpfx)$$file";    \
  261.     done > $@-tmp
  262.     mv -f $@-tmp $@
  263. else
  264.     cp /dev/null $@
  265. endif
  266.  
  267. ifneq ($(no_deps),t)
  268. # Include the generated dependencies of the sources in this directory.
  269. include $(objpfx)depend-$(subdir)
  270. endif
  271.  
  272. # Maximize efficiency by minimizing the number of rules.
  273. .SUFFIXES:    # Clear the suffix list.
  274. # Add the suffixes we use.
  275. .SUFFIXES: .a .o .S .s .c .h .d
  276.  
  277. # Generic rule for making directories.
  278. %/:
  279. # mkdir isn't smart enough to strip a trailing /.
  280.     mkdir $(@:%/=%)
  281.  
  282. # Make sure that object files are not removed
  283. # when they are intermediates between sources and library members.
  284. # This can go away with make v4.
  285. .PRECIOUS: %.o
  286.  
  287. # Make sure that the parent library archive is never removed.
  288. .PRECIOUS: $(libc.a)
  289.  
  290. # Use the verbose option of ar and tar when not running silently.
  291. ifeq    "$(findstring s,$(MAKEFLAGS))" ""    # if not -s
  292. verbose := v
  293. else                           # -s
  294. verbose    :=
  295. endif                        # not -s
  296.  
  297. ARFLAGS := r$(verbose)
  298.  
  299. # This makes all the object files in the parent library archive.
  300.  
  301. .PHONY: lib libobjs lib-noranlib
  302. $(libc.a): $(libc.a)(__.SYMDEF)
  303. lib: $(libc.a)
  304.  
  305. +libobjs := $(patsubst %,$(libc.a)(%),$(notdir $(objects)))
  306. libobjs: $(+libobjs)
  307. lib-noranlib: libobjs
  308.  
  309. # Define a pattern rule that will match many targets libc.%(foo.o), for
  310. # each foo in $(objects) (% will just happen always to match `a').  This is
  311. # the only way to define a rule that updates many targets at once with one
  312. # sequence of commands.
  313. ifdef objects
  314. $(patsubst %,$(libc.a:a=)\%(%),$(notdir $(objects))): $(objpfx)stamp-$(subdir);
  315. $(objpfx)stamp-$(subdir): $(objects)
  316. #    $(+libc_lock_open)
  317. ifdef objdir
  318.     cd $(objdir); $(AR) cru$(verbose) libc.a $(patsubst $(objpfx)%,%,$^)
  319. else
  320.     $(AR) cru$(verbose) $(..)libc.a $^
  321. endif
  322. #    $(+libc_lock_close)
  323.     touch $@
  324. endif
  325.  
  326. $(libc.a)(__.SYMDEF): $(+libobjs)
  327.     $(RANLIB) $@
  328.  
  329. define +libc_lock_open
  330. @. $(..)libc-lock-open
  331. endef
  332. define +libc_lock_close
  333. @rm -f $(..)LOCK-libc.a
  334. endef
  335.  
  336. # This makes all the object files.
  337. .PHONY: objects objs
  338. objects objs: $(objects)
  339.  
  340. # Installation.
  341.  
  342. # $(install-lib) are installed from the object directory into $(libdir);
  343. # files in $(install-lib) matching `lib%.a' are ranlib'd after installation
  344. # unless they also appear in $(non-lib.a).  $(install-data) are installed
  345. # as they are into $(datadir).  $(headers) are installed as they are in
  346. # $(includedir).  $(install-bin) and $(install-sbin) are installed from the
  347. # object directory into $(bindir) and $(sbindir), respectively.
  348. # $(install-others) are absolute path names of files to install; rules to
  349. # install them are defined elsewhere.
  350.  
  351. # The simple library name to install libc.a under.
  352. # This could be defined by a sysdep Makefile.
  353. ifndef libc-name
  354. libc-name := c
  355. endif
  356.  
  357. define do-install
  358. $(make-target-directory)
  359. $(INSTALL_DATA) $< $@
  360. endef
  361.  
  362. # Make the target directory if it doesn't exist.  Because of make's
  363. # directory cache, this will produce the `mkdir' command when the directory
  364. # already exists, if it didn't exist at the start of the `make' run.  The
  365. # `-' prefix ignores errors from mkdir, so there will just be some
  366. # gratuitous but harmless `File exists' messages.
  367. define make-target-directory
  368. $(addprefix -mkdir ,$(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%)))
  369. endef
  370.  
  371. # Any directory (parent or subdir) that has any object files to build
  372. # should install libc.a; this way "make install" in a subdir is guaranteed
  373. # to install everything it changes.
  374. ifdef objects
  375. install: $(libdir)/lib$(libprefix)$(libc-name).a
  376. # We avoid depending on lib-noranlib because that makes the parent make
  377. # subdir_lib in all the subdirs, when the make install run they do will
  378. # update the library anyway.  Running ranlib after installing makes the
  379. # __.SYMDEF time stamp up to date, which avoids messages from some linkers.
  380. # Depending on subdir_install gets all the subdirs to update the library,
  381. # and is optimal for `make install' at top level.
  382. $(libdir)/lib$(libprefix)$(libc-name).a: libobjs subdir_install
  383.     $(make-target-directory)
  384.     $(INSTALL_DATA) $(libc.a) $@
  385.     $(RANLIB) $@
  386. endif
  387.  
  388. ifdef install-bin
  389. $(addprefix $(bindir)/,$(install-bin)): $(bindir)/%: $(objpfx)%
  390.     $(make-target-directory)
  391.     $(INSTALL_PROGRAM) $< $@
  392. endif
  393. ifdef install-sbin
  394. $(addprefix $(sbindir)/,$(install-sbin)): $(sbindir)/%: $(objpfx)%
  395.     $(make-target-directory)
  396.     $(INSTALL_PROGRAM) $< $@
  397. endif
  398. ifdef install-lib
  399. install-lib.a := $(filter-out $(non-lib.a),$(filter lib%.a,$(install-lib)))
  400. install-lib-non.a := $(filter-out lib%.a,$(install-lib)) $(non-lib.a)
  401. ifdef install-lib-non.a
  402. $(addprefix $(libdir)/$(libprefix),$(install-lib-non.a)): \
  403.   $(libdir)/$(libprefix)%: $(objpfx)%
  404.     $(do-install)
  405. endif
  406. ifdef install-lib.a
  407. $(install-lib.a:lib%.a=$(libdir)/lib$(libprefix)%.a): \
  408.   $(libdir)/lib$(libprefix)%.a: $(objpfx)lib%.a
  409.     $(do-install)
  410.     $(RANLIB) $@
  411. endif
  412. endif
  413. ifdef install-data
  414. $(addprefix $(datadir)/,$(install-data)): $(datadir)/%: %;$(do-install)
  415. endif
  416. headers := $(strip $(headers))
  417. ifdef headers
  418. $(addprefix $(includedir)/,$(headers)): \
  419.     $(includedir)/%: %;$(do-install)
  420. endif    # headers
  421.  
  422. .PHONY: install-bin-nosubdir install-sbin-nosubdir install-lib-nosubdir \
  423.     install-data-nosubdir install-headers-nosubdir
  424. install-bin-nosubdir: $(addprefix $(bindir)/,$(install-bin))
  425. install-sbin-nosubdir: $(addprefix $(sbindir)/,$(install-sbin))
  426. install-lib-nosubdir: $(addprefix $(libdir)/,\
  427.                $(patsubst lib%.a,lib$(libprefix)%.a,$(install-lib.a)) \
  428.                $(addprefix $(libprefix),$(install-lib-non.a)))
  429. install-data-nosubdir: $(addprefix $(datadir)/,$(install-data))
  430. install-headers-nosubdir: $(addprefix $(includedir)/,$(headers))
  431. install-others-nosubdir: $(install-others)
  432.  
  433. # We need all the `-nosubdir' targets so that `install' in the parent
  434. # doesn't depend on several things which each iterate over the subdirs.
  435. # This rule makes `install-FOO' always use `install-FOO-nosubdir' as a
  436. # subroutine.  Then in the parent `install-FOO' also causes subdir makes.
  437. install-%:: install-%-nosubdir ;
  438.  
  439. .PHONY: install install-no-libc.a-nosubdir
  440. install-no-libc.a-nosubdir: install-headers-nosubdir install-data-nosubdir\
  441.                 install-bin-nosubdir install-lib-nosubdir    \
  442.                 install-others-nosubdir install-sbin-nosubdir
  443. install: install-no-libc.a-nosubdir
  444.  
  445. # Command to compile $< in $(objdir) using the native libraries.
  446. define native-compile
  447. cwd=`pwd`; cd $(@D); $(BUILD_CC) $(BUILD_CFLAGS) \
  448.        $(addprefix $$cwd/,$^) -o $(@F)
  449. endef
  450.  
  451. # Command to compile $< in $(common-objdir) using the native libraries.
  452. define common-objdir-compile
  453. cd $(@D); $(BUILD_CC) $(BUILD_CFLAGS) $(<:$(common-objpfx)%=%) -o $(@F)
  454. endef
  455.  
  456. # We always want to use configuration -D switches.
  457. BUILD_CFLAGS = $(config-defines)
  458.  
  459. # Support the GNU standard name for this target.
  460. .PHONY: check
  461. check: tests
  462.  
  463. .PHONY: TAGS
  464. TAGS: distinfo $(..)MakeTAGS
  465.     $(MAKE) $(addprefix -f ,$^)
  466.  
  467. .PHONY: echo-headers
  468. echo-headers:
  469.     @echo $(headers)
  470.  
  471.  
  472. # Common cleaning targets.
  473.  
  474. .PHONY: common-mostlyclean common-clean mostlyclean clean
  475. clean: common-clean
  476. mostlyclean: common-mostlyclean
  477.  
  478. # Remove the object files.
  479. common-mostlyclean:
  480.     -rm -f $(addprefix $(objpfx),$(tests) $(others) \
  481.                      $(addsuffix .o,$(tests) $(others)) \
  482.                      $(addsuffix .out,$(tests)))
  483.     -rm -f $(objects) $(addprefix $(objpfx),$(extra-objs) stamp-$(subdir))
  484.     -rm -f core TAGS
  485.  
  486. # Also remove the dependencies and generated source files.
  487. common-clean: common-mostlyclean
  488.     -rm -f $(objpfx)depend-$(subdir) $(+depfiles)
  489.     -rm -f $(addprefix $(objpfx),$(generated))
  490.  
  491. # Produce a file `stub-$(subdir)' which contains `#define __stub_FUNCTION'
  492. # for each function which is a stub.  We grovel over all the .d files
  493. # looking for references to source files in sysdeps/stub.  Then we grovel
  494. # over each referenced source file to see what stub function it defines.
  495.  
  496. .PHONY: stubs # The parent Makefile calls this target.
  497. stubs: $(common-objpfx)stub-$(subdir)
  498. $(common-objpfx)stub-$(subdir): $(+depfiles)
  499. # Use /dev/null since `...` might expand to empty.
  500.     $(patsubst %,cd %;,$(objdir)) \
  501.     sed -n 's/^stub_warning *(\([^)]*\).*$$/#define __stub_\1/p' \
  502.         `sed -n 's@^.*\($(sysdep_dir)/stub/[a-z0-9_]*\.c\).*$$@\1@p' \
  503.          $(patsubst $(objpfx)%,%,$^) /dev/null` \
  504.         /dev/null > $@T
  505.     mv -f $@T $@
  506.  
  507. # Make the distribution tar file.
  508.  
  509. .PHONY: dist
  510. dist: distinfo $(..)Make-dist 
  511.     $(MAKE) -f $< -f $(word 2,$^) $(Make-dist-args)
  512.  
  513. dist: $(distribute)
  514.  
  515. # We used to simply export all these variables, but that frequently made the
  516. # environment get too large.  Instead, we write all the information into
  517. # a generated makefile fragment `distinfo', and then include it with -f in
  518. # the sub-make that makes the distribution (above).
  519. distinfo: Makefile $(..)Makerules
  520.     $(distinfo-vars)
  521.     mv -f $@.new $@
  522.  
  523. define distinfo-vars
  524. rm -f $@.new
  525. $(foreach var,subdir sources elided-routines headers distribute \
  526.           dont_distribute generated others tests,
  527. echo >> $@.new '$(var)    := $($(var))')
  528. echo >> $@.new 'sources := $$(sources) $$(addsuffix .c,$$(elided-routines))'
  529. endef
  530.  
  531. ifneq (,$(strip $(gpl2lgpl)))
  532. ifneq (,$(wildcard $(..)gpl2lgpl.sed))
  533. # Snarf from the master source and frob the copying notice.
  534. $(gpl2lgpl): %: $(..)gpl2lgpl.sed /home/gd/gnu/lib/%
  535.     sed -f $^ > $@-tmp
  536. # So I don't edit them by mistake.
  537.     chmod a-w $@-tmp
  538.     mv -f $@-tmp $@
  539. endif
  540. endif
  541.